#include  <stdio.h>
#define   N   10
double fun(double x[]);
main()
{ int  i;     
  double  x[N],av;
  for(i=0; i<N; i++) scanf("%lf",x+i);
  printf("\n");
  av=fun(x);
  printf("\nThe average is: %f\n",av);
  printf("\nThe result :\n");
  for(i=0; i<N; i++)  printf("%5.0f ",x[i]);
  printf("\n");
}

double fun(double x[])
//ÇëÔÚÏÂÃæÌîÈë´úÂë£¬²»Òª¸Ä¶¯ÉÏÃæµÄ³ÌÐò
{
	int i,j;
	double s=0,a,t;
	for(i=0;i<N;i++)s=s+x[i];
	a=s/N;
	for(i=0;i<N/2;i++){
		if(x[i]<a){
			t=x[i];
			for(j=N;x[j]<a;j--);
			x[i]=x[j];
			x[j]=t;
		}
	}
	return a;
}
